package trading.spring;

import java.util.Map;

import org.apache.velocity.app.VelocityEngine;
import org.apache.velocity.exception.VelocityException;
import org.springframework.ui.velocity.VelocityEngineUtils;

/**
 * This class wraps the {@link VelocityEngineUtils} with a service.  This is useful when we want
 * to mock up Velocity in a test.
 *
 * @author Eyal Erez (eerez@wgen.net)
 */
public interface VelocityService {

    /**
     * Merge the specified Velocity template with the given model into a String.
     *
     * @param model the Map that contains model names as keys and model objects as values
     * @param templateLocation the location of template, relative to Velocity's resource loader
     * path
     * @return the result as String
     * @throws VelocityException if the template wasn't found or rendering failed
     * @see VelocityEngineUtils#mergeTemplateIntoString
     */
    String mergeTemplateIntoString(Map<String, Object> model, String templateLocation)
        throws VelocityException;
    
    /**
     * Used to set the velocity engine configured in Integration tests. 
     * @param velocityEngine the velocity engine to set.
     */
    public void setVelocityEngine(VelocityEngine velocityEngine);
}
